package cn.com.egova.demoapplication;

import android.graphics.drawable.AnimationDrawable;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;

import butterknife.ButterKnife;
import butterknife.InjectView;
import butterknife.OnClick;
import cn.com.egova.demoapplication.base.BaseActivity;

public class FrameAnimaActivity extends BaseActivity {

    @InjectView(R.id.btn_start)
    Button btnStart;
    @InjectView(R.id.btn_end)
    Button btnEnd;
    @InjectView(R.id.iv)
    ImageView iv;
    private AnimationDrawable animaDrawable;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_frame_anima);
        ButterKnife.inject(this);

    }

    @Override
    public boolean isBackIconVisible() {
        return true;
    }


    @OnClick({R.id.btn_start, R.id.btn_end})
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.btn_start:
                animaDrawable = (AnimationDrawable)iv.getDrawable();
                if(animaDrawable!=null){
                    animaDrawable.start();
                }
                break;
            case R.id.btn_end:
                animaDrawable.stop();
                break;
        }
    }
}
